﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="apple-touch-fullscreen" content="yes" />
    <meta name="format-detection" content="email=no" />
    <meta name="wap-font-scale" content="no" />
    <meta name="viewport" content="user-scalable=no, width=device-width" />
    <meta content="telephone=no" name="format-detection" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Login</title>
    <link rel="stylesheet" href="~/Content/login/layui/css/layui.css">
    <link id="layuicss-laydate" rel="stylesheet" href="~/Content/login/layui/css/modules/laydate/default/laydate﹖v=5.3.1.css" media="all">
    <link id="layuicss-layer" rel="stylesheet" href="~/Content/login/layui/css/modules/layer/default/layer﹖v=3.5.1.css" media="all">
    <link id="layuicss-skincodecss" rel="stylesheet" href="~/Content/login/layui/css/modules/code﹖v=2.css" media="all">
    <link href="~/Content/login/axui/css/ax.css" rel="stylesheet" />
    <link href="~/Content/login/axui/css/ax-response.css" rel="stylesheet" />
    <link href="~/Content/login/axui/css/main.css" rel="stylesheet" />
    <link href="~/Content/login/axui/css/dropzone.css" rel="stylesheet" />
    <style>
        @@media (min-width:767px) {
            .fileupload {
                width: 93%;
            }
        }
    </style>
</head>

<body class="ax-align-origin">
    <div class="login ax-shadow-cloud ax-radius-md">
        <div class="ax-row ax-radius-md ax-split">
            <div class="ax-col ax-col-14 ax-radius-left ax-radius-md cover"></div>
            <div class="ax-col ax-col-10">
                <div class="core">

                    <div class="ax-break"></div>

                    <div class="ax-tab" axTab>

                        <ul class="ax-row ax-tab-nav ax-menu-tab">
                            <a href="###" class="ax-item">登录账号</a>
                            <a href="###" class="ax-item">注册新用户</a>
                            <li class="ax-col"></li>
                        </ul>

                        <ul class="ax-tab-content">

                            <li>
                                <form class="layui-form">
                                    <div class="ax-break"></div>
                                    <div class="ax-break ax-hide-tel"></div>

                                    <div class="ax-form-group">
                                        <div class="ax-flex-row">
                                            <div class="ax-form-con">
                                                <div class="ax-form-input"><span class="ax-pos-left" style="width: 2.4rem;"><i class="ax-iconfont ax-icon-me-f"></i></span><input name="username" value="admin" placeholder="输入登录账号" type="text" lay-verify="required" lay-reqtext="请输入登录账号"><span class="ax-pos-right"><a href="###" class="ax-iconfont ax-icon-close ax-val-none"></a></span></div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="ax-break-md"></div>

                                    <div class="ax-form-group">
                                        <div class="ax-flex-row">
                                            <div class="ax-form-con">
                                                <div class="ax-form-input">
                                                    <span class="ax-pos-left" style="width:2.4rem;"><i class="ax-iconfont ax-icon-lock-f"></i></span>
                                                    <input name="password" placeholder="输入登录密码" type="password" lay-verify="required" lay-reqtext="请输入登录密码"><span class="ax-pos-right"><a href="###" class="ax-iconfont ax-icon-close ax-val-none"></a></span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="ax-break-md"></div>

                                    <div class="ax-form-group">
                                        <div class="ax-flex-row">
                                            <div class="ax-form-con">
                                                <div class="ax-form-input">
                                                    <div class="ax-row">
                                                        <div class="ax-flex-block">
                                                            <span class="ax-pos-left" style="width:2.4rem;"><i class="ax-iconfont ax-icon-shield-f"></i></span>
                                                            <input name="verifyCode" placeholder="输入验证码..." value="" type="text" lay-verify="verifyCode" lay-reqtext="请输入验证码"><span class="ax-pos-right"><a href="###" class="ax-iconfont ax-icon-close ax-val-none"></a></span>
                                                        </div>
                                                        <a href="###" class="ax-form-img"> <canvas id="canvas" width="140" height="38"></canvas></a>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="ax-break-md"></div>

                                    <div class="ax-form-group">
                                        <div class="ax-flex-row">
                                            <div class="ax-flex-block">
                                                <div class="ax-form-input"><button type="button" id="submit" lay-submit="" lay-filter="login" class="ax-btn ax-primary ax-full">系  统  登  录</button></div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="ax-break"></div>
                                    <div class="ax-break ax-hide-tel"></div>
                                    <div class="ax-break ax-hide-tel"></div>
                                </form>
                            </li>

                            <li>
                                <form class="layui-form">

                                    <div class="ax-break"></div>
                                    <div class="ax-break ax-hide-tel"></div>

                                    <div class="ax-form-group">
                                        <div class="ax-flex-row">
                                            <div class="ax-form-con">
                                                <div class="ax-form-input"><span class="ax-pos-left" style="width: 2.4rem;"><i class="ax-iconfont ax-icon-qrcode"></i></span><input name="unifiedSocialCreditCode" placeholder="输入企业统一社会信用代码" type="text" lay-verify="required" lay-reqtext="请输入统一社会信用代码"><span class="ax-pos-right"><a href="###" class="ax-iconfont ax-icon-close ax-val-none"></a></span></div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="ax-break-md"></div>

                                    <div class="ax-form-group">
                                        <div class="ax-flex-row">
                                            <div class="ax-form-con">
                                                <div class="ax-form-input"><span class="ax-pos-left" style="width: 2.4rem;"><i class="ax-iconfont ax-icon-seal-f"></i></span><input name="companyName" placeholder="输入企业名称" type="text" lay-verify="required" lay-reqtext="请输入企业名称"><span class="ax-pos-right"><a href="###" class="ax-iconfont ax-icon-close ax-val-none"></a></span></div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="ax-break-md"></div>

                                    <div class="ax-form-group">
                                        <div class="ax-flex-row">
                                            <div class="ax-form-con">
                                                <div class="ax-form-input"><span class="ax-pos-left" style="width: 2.4rem;"><i class="ax-iconfont ax-icon-me-f"></i></span><input name="contactUser" placeholder="输入企业联系人" type="text" lay-verify="required" lay-reqtext="请输入企业联系人"><span class="ax-pos-right"><a href="###" class="ax-iconfont ax-icon-close ax-val-none"></a></span></div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="ax-break-md"></div>

                                    <div class="ax-form-group">
                                        <div class="ax-flex-row">
                                            <div class="ax-form-con">
                                                <div class="ax-form-input"><span class="ax-pos-left" style="width: 2.4rem;"><i class="ax-iconfont ax-icon-phone-f"></i></span><input name="contactPhone" placeholder="输入企业联系电话" type="text" lay-verify="contactPhone" lay-reqtext="请输入企业联系电话"><span class="ax-pos-right"><a href="###" class="ax-iconfont ax-icon-close ax-val-none"></a></span></div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="ax-break-md"></div>

                                    <div class="ax-form-group">
                                        <div class="ax-flex-row fileupload" style="display:block">
                                            <div class="ax-dropzone-outer">
                                                <div class="ax-dropzone" id="upload01">
                                                    <ul class="ax-grid ax-space-md"></ul>
                                                </div>
                                            </div>
                                            <div id="previewTemplate" style="display: none;">
                                                <ul>
                                                    <li>
                                                        <div class="ax-item">
                                                            <div class="ax-operate"></div>
                                                            <div class="ax-preview">
                                                                <div class="ax-image" data-image="">
                                                                    <div class="ax-progress" data-progress=""></div>
                                                                    <div class="ax-percent" data-percent=""></div>
                                                                    <div class="ax-success-mark"><i class="ax-iconfont ax-icon-check"></i></div>
                                                                    <div class="ax-error-mark"><i class="ax-iconfont ax-icon-close"></i></div>
                                                                    <div class="ax-error-message" data-errormessage=""></div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </li>
                                                </ul>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="ax-break-md"></div>

                                    <div class="ax-form-group">
                                        <div class="ax-flex-row">
                                            <div class="ax-flex-block">
                                                <div class="ax-form-input"><button type="button" id="register" lay-submit="" lay-filter="register" class="ax-btn ax-primary ax-full">系  统  注  册</button></div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="ax-break"></div>
                                    <div class="ax-break ax-hide-tel"></div>
                                    <div class="ax-break ax-hide-tel"></div>
                                </form>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="~/Content/login/layui/layui.js"></script>
    <script src="~/Content/plugin/jquery/jquery.min.js"></script>
    <script src="~/Content/login/axui/js/ax.min.js"></script>
    <script src="~/Content/login/axui/js/code.js"></script>
    <script src="~/Content/login/axui/js/dropzone.js"></script>
    <script src="~/Content/plugin/jquery.blockUI/jquery.blockUI.min.js"></script>
    <script src="~/Content/framework/js/framework.min.js"></script>
    <script type="text/javascript">
        $(function () {
            code_draw();
            // 点击后刷新验证码
            $("#canvas").on('click', function () {
                code_draw();
            })
            $(".btn").on('click', function () {
                // 将输入的内容转为大写，可通过这步进行大小写验证
                var val = $(".input-val").val().toLowerCase();
                // 获取生成验证码值
                var num = $('#canvas').attr('data-code');
                if (val == '') {
                    alert('请输入验证码！');
                } else if (val == num) {
                    alert('提交成功！');
                    $(".input-val").val('');
                    draw(show_num);

                } else {
                    alert('验证码错误！请重新输入！');
                    $(".input-val").val('');
                    draw(show_num);
                }
            })
        })
        layui.use(["form"], function () {
            const form = layui.form;
            form.verify({
                verifyCode: function (value, item) {
                    var value = value.toLowerCase();
                    // 获取生成验证码值
                    var generateCode = $('#canvas').attr('data-code');
                    if (value.length == 0) {
                        return "请输入验证码！";
                    }
                    if (value != generateCode) {
                        return "验证码不正确！";
                    }
                },
                contactPhone: function (value, item) { 
                    if (value.length == 0) {
                        return "请输入企业联系电话！";
                    }
                     
                    var mobile = /^1[3|4|5|6|7|8|9]\d{9}$/, phone = phone = /^0\d{2,3}-?\d{7,8}$/;
                    var flag = mobile.test(value) || phone.test(value);
                    if (!flag) {
                        return '请输入正确的联系电话';
                    }
                    return false
                }
            });
            //登录
            form.on("submit(login)", function (data) {
                var date = new Date();
                frame.ajax({
                    url: '@Url.Content("/Login/CheckLogin")',
                    type: "get",
                    data:
                    {
                        account: $('input[name="username"]').val(),
                        password: $('input[name="password"]').val()
                    },
                    beforeSend: function () {
                        $('#submit').text('正在登录......');
                        $('#submit').attr("disabled", "disabled");
                        $('#submit').css('background', '#C0C0C0');
                    },
                    success: function (result) {
                        var timediff = new Date().getTime() - date.getTime();
                        if (result.success) {
                            layer.msg("登录成功！", { icon: 1, time: 1000 });
                            location.href = result.data;
                        }
                        else {
                            layer.msg(result.message, { icon: 2, time: 2000 });
                            setTimeout(function () {
                                $('#submit').text(' 系  统  登  录 ');
                                $('#submit').removeAttr("disabled");
                                $('#submit').css('background', '#1E9FFF');
                            }, timediff <= 800 ? 800 : 0)
                        }
                    }
                });
            });

            //注册
            form.on("submit(register)", function (data) {
                var date = new Date();
                frame.ajax({
                    url: '@Url.Content("/Login/CheckLogin")',
                    type: "get",
                    data:
                    {
                        account: $('input[name="username"]').val(),
                        password: $('input[name="password"]').val()
                    },
                    beforeSend: function () {
                        $('#register').text('正在注册......');
                        $('#register').attr("disabled", "disabled");
                        $('#register').css('background', '#C0C0C0');
                    },
                    success: function (result) {
                        var timediff = new Date().getTime() - date.getTime();
                        if (result.success) {
                            layer.msg("注册成功！", { icon: 1, time: 1000 });
                            location.href = result.data;
                        }
                        else {
                            layer.msg(result.message, { icon: 2, time: 2000 });
                            setTimeout(function () {
                                $('#register').text(' 系  统  注  册 ');
                                $('#register').removeAttr("disabled");
                                $('#register').css('background', '#1E9FFF');
                            }, timediff <= 800 ? 800 : 0)
                        }
                    }
                });
            });
        });
        var myDropzone = new Dropzone("#upload01", {
            url: "ax-upload-script.php",
            previewTemplate: document.querySelector('#previewTemplate').innerHTML,
            paramName: "file",
            maxFiles: 1,
            addRemoveLinks: true,
            autoProcessQueue: false,
            acceptedFiles: ".jpg,.png",
            init: function () {
                this.on("addedfile", function (file) {
                    // 当添加文件时触发
                    if (this.files.length > 1) {
                        // 如果文件数量超过1个，移除旧文件
                        this.removeFile(this.files[0]);
                    }
                });
            }
        });
    </script>
</body>
</html>